package com.lh0811.forge.pserv.cgen.server.util;

import com.google.common.collect.Lists;
import com.lh0811.forge.pserv.cgen.server.component.CodeGenConfig;

import java.io.File;
import java.io.FileOutputStream;
import java.util.List;

/**
 * @author lh0811
 * @date 2022/2/10
 */
public class MainGen {

    private static List<String> tableList = Lists.newArrayList(
            "pserv_ebus_event",
            "pserv_ebus_event_ack",
            "pserv_ebus_topic"
    );

    public static void main(String[] args) throws Exception {
        File pathFile = new File(CodeGenConfig.getInstance().getPath());
        if (!pathFile.exists()) {
            pathFile.mkdirs();
        }
        File f = new File(CodeGenConfig.getInstance().getPath() + "/" + CodeGenConfig.getInstance().getFileName());
        byte[] bytes = MainGenUtils.generatorCode(tableList);
        FileOutputStream fs = new FileOutputStream(f);
        fs.write(bytes);
        fs.close();
    }


}
